#ifndef OBJECTPOINT_H
#define OBJECTPOINT_H
#include "math.h"
#include "strstream"
#include <iostream>
#include <sstream>

using namespace std;
class PointF {
public:
    PointF(){}
    PointF(float xx, float yy)
    {
        X = xx;
        Y = yy;
    }
    float X;
    float Y;
    float Z;
};


class objectPoint
{

private:
    double _X, _Y, _R;
    double _theta, _SIN, _COS;

public:
    int Index;
    int SegmentID;

    objectPoint();
    objectPoint(double theta, int index);
    objectPoint(PointF p);
    objectPoint(double x, double y);


    double ToDeg(double value)
    {
        return value * 180 / M_PI;
    }
    double ToRad(double value)
    {
        return value * M_PI / 180 ;
    }
    double getCOS() { return _COS; }

    double getSIN(){ return _SIN; }
    //--
    double getY() { return _Y; }
    void setY(double value)
    {
        _Y = value;
        Set_Theta();
    }
    //--
    double getX() { return _X; }
    void setX(double value)
    {
        _X = value;
        Set_Theta();
    }
    //--
    PointF * getPointXY() { return ( new PointF( (float)_X , (float)_Y) ); }
    void  setPointXY(PointF value)
    {
        _X = value.X;
        _Y = value.Y;
        Set_Theta();
    }
    //--
    double getR() { return _R; }
    void setR(double value)
    {
        _R = value;
        _X = _R * _COS;
        _Y = _R * _SIN;
    }
    //--
    double getTheta() { return _theta; }
    void setTheta(double value)
    {
        Set_Theta(value);
        _X = _R * _COS;
        _Y = _R * _SIN;
    }
    //--
    double getTheta_Deg()
    {
        return ToDeg(_theta);
    }
    void setTheta_Deg(double value)
    {
        setTheta(ToRad(value));
    }
    //--
    double getDistanceFromPoint(objectPoint p);
    double GetDegreeFrom(objectPoint p);
    void Set_Theta(double t);
    void Set_Theta();
    void SetXY(double x, double y);
    string toString();
};
#endif // OBJECTPOINT_H
